<!DOCTYPE HTML>
<html>
<head>
<title>Register</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
 <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Graph CSS -->
<link href="css/font-awesome.css" rel="stylesheet"> 
<!-- jQuery -->
<link href='https://fonts.googleapis.com/css?family=Roboto:700,500,300,100italic,100,400' rel='stylesheet' type='text/css'>
<!-- lined-icons -->
<link rel="stylesheet" href="css/icon-font.min.css" type='text/css' />
<!-- //lined-icons -->
<script src="js/jquery-1.10.2.min.js"></script>
<!--clock init-->
</head> 
<body>
								<!--/login-->
								
									   <div class="error_page">
												<!--/login-top-->
												
													<div class="error-top">
													<h2 class="inner-tittle page">PandaBI</h2>
													    <div class="login">
														<h3 class="inner-tittle t-inner">注册</h3>
																<!--<form>-->
																		<input type="text" class="email" value="E-mail address" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'E-mail address';}" >
																		<input type="password" class="password" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
																		<input type="password" class="rePassword" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
																		<div class="sign-up">
																					<input type="reset" value="重置">
																					<input type="submit" onclick="register()" value="注册">
																			
																		</div>
																		<div class="clearfix"></div>
																		
																		<div class="new">
																			<p><label class="checkbox11"><input type="checkbox" name="checkbox"><i> </i>同意条款</label></p>
																			<p class="sign">已有账号 ? <a href="loginPage">登录</a></p>
																			<div class="clearfix"></div>
																		</div>
																<!--</form>-->
														</div>
														
													</div>
													 </div>
												<!--//login-top-->
										  
										  	<!--//login-->
										    <!--footer section start-->
										<div class="footer">
											<p>Copyright &copy; 2018.SCU <a href="" target="_blank" title="">CS</a> - Collect from <a href="" title="" target="_blank">WSN</a></p>
										</div>
									<!--footer section end-->
									<!--/404-->
<script type="text/javascript">
	var register = function () {
		var account = $("input[class='email']").val();
		var password = $("input[class='password']").val();
		var rePassword = $("input[class='rePassword']").val();
		var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
		if(account==""||!reg.test(account)){
		    $("input[class='email']").val("邮箱地址输入有误！");
		}else if(password==""||rePassword==""||password!=rePassword){
            $("input[class='password']").val("");
            $("input[class='rePassword']").val("");
		}else {
            $.ajax({
                url:'register',
                type:'post',
                data:{"account":account,"password":password},
				dataType:'JSON',
                success:function (data) {
                    if(data.register=="1"){
                        window.location.href="index";
                    }else if(data.register=="0"){
                        alert("用户名已存在");
                        window.location.href="regPage";
					}
                }
            },'json');
		}
    };

</script>
<!--js -->
<script src="js/jquery.nicescroll.js"></script>
<script src="js/scripts.js"></script>
<!-- Bootstrap Core JavaScript -->
   <script src="js/bootstrap.min.js"></script>
</body>
</html>